#pragma once

#include "d3d9.h"
#include "d3dx9.h"
#include <stdio.h>    // required for sprintf_s function
#include <sstream>	  // string stream for numeric conversions
#include <string>
#include <fstream>
#include <iostream>
#include "SpriteManager.h"
#include "DirectInput.h"
#include "Text.h"

// Add pragma comments so we do not have to change
// the project dependencies
#pragma comment (lib, "d3d9.lib")
#pragma comment (lib, "d3dx9.lib")

using namespace std;

class HighScore
{
private:
	// Singleton instance
	static HighScore*	m_HighScoreInstance;
	
	// DirectInput Pointer
	DirectInput*		m_pDirectInput;
	bool				bKeyDown[256];

	static const short sSize = 10;

public:
	// Pointer to Text
	Text*		m_pText;

	string		strLName;
	string		strLname;
	string		strLscore;
	bool		bPass;
	short		sLScore;

	struct Score
	{
		short sScores;
		short sTemp;
		string strName;
		string strScore;
		string strTmp;
	};
	Score		Scores[sSize];
	 
	HighScore(void);
	~HighScore(void);

	// Singleton functions
	static HighScore* GetInstance(void);
	void DeleteHighScoreInstance(void);

	void InitHighScore(IDirect3DDevice9* m_pD3DDevice, HWND hWnd, HINSTANCE hInst, DirectInput* directInput);
	void WriteToFile();
	void ReadFromFile();
	void SortBoard();
	void ShowBoard();
	bool GetUserName(HWND hWnd);
	string ReturnName(void);
};